package com.example.com.hsapp;

import java.util.Hashtable;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class HarlemActivity extends Activity {

	public static Hashtable hash = new Hashtable();
	final static int REQUEST_VIDEO_CAPTURED = 1;
	private Button recButton;
	Uri uriVideo = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		recButton = (Button) findViewById(R.id.buttonRec);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.harlem, menu);
		return true;
	}

	public void onClickRec(View v) {

		Intent intent = new Intent(
				android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
		startActivityForResult(intent, REQUEST_VIDEO_CAPTURED);

	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		if (resultCode == RESULT_OK) {
			if (requestCode == REQUEST_VIDEO_CAPTURED) {
				uriVideo = data.getData();
				hash.put("video1", uriVideo);
				Toast.makeText(this, uriVideo.getPath(), Toast.LENGTH_LONG)
						.show();
				Intent i = new Intent(this, SecondActivity.class);
				startActivity(i);
			}
		} else if (resultCode == RESULT_CANCELED) {
			uriVideo = null;
			// Toast.makeText(AndroidIntentVideoRecording.this, "Cancelled!",
			// Toast.LENGTH_LONG).show();
		}
	}

}
